package com.mmm.station.config.security;



import com.mmm.station.security.entity.PermissionInfo;
import com.mmm.station.security.entity.Token;
import com.mmm.station.security.method.Realm;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by mmm on 2016/12/6.
 */
public class MyRealm implements Realm {


    @Override
    public PermissionInfo getPermission(Object o) {
        PermissionInfo permissionInfo = new PermissionInfo();
        List<String> role = new ArrayList<>();
//        role.add("aa");
        role.add("bb");
        role.add("cc");
        permissionInfo.setRoles(role);
        return permissionInfo;
    }

    @Override
    public Object getAnthInfo(Token token) {
        System.out.println("》》》》》》》》》》》》》》进入验证《《《《《《《《《《《《《");
        System.out.println(token.getAccount());
        System.out.println(token.getPassword());
        if (token.getAccount() != null && token.getPassword() !=null){
            return token;
        }

        return null;
    }


}
